Find the N degrees of number 2ΒΆ
Find the value of N where N degrees of number 2
are written sequentially in a line without spaces.
def ndegrees(num):
ans = True
n, tempn, i = 2, 2, 2
while ans:
if str(tempn) in num:
i += 1
tempn = pow(n, i)
else:
ans = False
return i - 1;
print(ndegrees("2481632"))
print(ndegrees("248163264"))
Output:
5
6